#!/bin/sh -e
## install.dpatch by Sylvain Le Gall <gildor@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: No description.

if [ $# -lt 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch}"

case "$1" in
       -patch) patch $patch_opts -p1 < $0;;
       -unpatch) patch $patch_opts -p1 -R < $0;;
        *)
                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
                exit 1;;
esac

exit 0

@DPATCH@
diff -urN camlimages-2.2/Makefile camlimages-2.2-debian/Makefile
--- camlimages-2.2/Makefile	2004-10-02 17:49:05.000000000 +0200
+++ camlimages-2.2-debian/Makefile	2004-10-22 16:05:28.620631504 +0200
@@ -89,18 +89,18 @@
 		$(WITH_XPM) \
 		$(WITH_FREETYPE)
 
-installopt: install
+install.byt: byt
+	mkdir -p $(DESTDIR)$(LIBDIR)
+	for i in $(BUILDDIRS); do (cd $$i; $(MAKE) install.byt LIBDIR=$(DESTDIR)$(LIBDIR)) || exit $$?; done
+	$(CP) Makefile.config $(DESTDIR)$(LIBDIR)
+	$(CP) config.h $(DESTDIR)$(LIBDIR)
+
+install.opt: opt
+	for i in $(BUILDDIRS); do (cd $$i; $(MAKE) install.opt LIBDIR=$(DESTDIR)$(LIBDIR)) || exit $$?; done
+
+install: install.byt
+	$(RANLIB) $(DESTDIR)``:$(LIBDIR)/*.a
 
-install: all
-	mkdir -p $(LIBDIR)
-	if test -w $(CAMLDIR)/ld.conf \
-        && test `grep -s -c '^$(LIBDIR)$$' $(CAMLDIR)/ld.conf` = 0; then \
-	    echo $(LIBDIR) >> $(CAMLDIR)/ld.conf; \
-	fi
-	for i in $(BUILDDIRS); do (cd $$i; $(MAKE) install) || exit $$?; done
-	$(CP) Makefile.config $(LIBDIR)
-	$(CP) config.h $(LIBDIR)
-	$(RANLIB) $(LIBDIR)/*.a
 
 depend:
 	for i in $(BUILDDIRS); do (cd $$i; $(MAKE) depend) || exit $$?; done
diff -urN camlimages-2.2/Makefile.shared camlimages-2.2-debian/Makefile.shared
--- camlimages-2.2/Makefile.shared	2004-10-02 16:20:09.000000000 +0200
+++ camlimages-2.2-debian/Makefile.shared	2004-10-22 16:07:24.053083104 +0200
@@ -44,10 +44,15 @@
 clean::
 	rm -f *.cm[iox] *.o *.cma *.cmxa *.a *.so *~
 
-install:: all
+install.byt:: byt
 	- mkdir -p $(LIBDIR)
-	- cp -p *.mli *.cm[iox] *.o *.cma *.cmxa *.a *.so $(LIBDIR)
+	- cp -p *.mli *.cm[io] *.o *.cma *.a *.so $(LIBDIR)
 
+install.opt:: opt
+	- mkdir -p $(LIBDIR)
+	- cp -p *.mli *.cmx *.o *.cmxa *.a *.so $(LIBDIR)
+
+install:: install.byt install.opt
 #######
 
 .SUFFIXES:
